<template>
	<view>
		<web-view :src="externalHtml"></web-view>
	</view>
</template>
<script>
	export default {
		name: "OneClick",
		data: function() {
			return {
				externalHtml: '../../../static/html/oneClick.html',
			}
		},
		watch: {

		},
		mounted: function() {
			window.addEventListener("message", this.handleMessage);
		},
		onLoad() {
			let self = this;
		},
		methods: {
			handleMessage(evt) {
				console.log('====这里是webview接收到的消息：' + JSON.stringify(evt));
				uni.navigateTo({
					url: '/pages/users/one_click/index'
				})
			}
		},
		// 离开页面时清除监听
		onHide() {
			window.removeEventListener('message', this.handleMessage);
		},
	};
</script>
<style lang="scss" scoped>
	page {
		background: #fff;
	}
</style>